package com.mq.topic;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @author ytj
 * @date 2024/1/15
 */
@Component
public class Demo2Producer {
    @Resource
    private RabbitTemplate rabbitTemplate;

    public void topic1Send(Integer id,String routeKey){
        Demo2Message demo2Message=new Demo2Message(id);
        this.rabbitTemplate.convertAndSend(Demo2Message.ExCHANGE_NAME,routeKey,demo2Message);
    }

}
